[XEND] Use VDI.location rather than VDI.image_uri/uri for Xen API
authorAlastair Tse <atse@xensource.com>
Wed, 31 Jan 2007 15:05:58 +0000 (15:05 +0000)
committerAlastair Tse <atse@xensource.com>
Wed, 31 Jan 2007 15:05:58 +0000 (15:05 +0000)
Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendAPI.py
tools/python/xen/xend/XendVDI.py

index b3d9e39bd1ce223a0d21d5844aa00af8710b2e4f..c1ecf3cab364cb9bf02491b59254bbfbe2f05a92 100644 (file)
@@ -1469,7 +1469,7 @@ class XendAPI(object):
             vdi = XendNode.instance().get_vdi_by_uuid(vdi_ref)
             if not vdi:
                 return xen_api_error(['VDI_HANDLE_INVALID', vdi_ref])
-            vdi_image = vdi.get_image_uri()
+            vdi_image = vdi.get_location()
             vbd_ref = XendTask.log_progress(0, 100,
                                             dom.create_vbd,
                                             vbd_struct, vdi_image)
index 0868814c8f72cc3a824b2b9c9e198d8ec01d46b5..f0dda203a8344e1e47890ecc59ec448ad2577d76 100644 (file)
@@ -73,6 +73,7 @@ class XendVDI(AutoSaveObject):
         self.sharable = False
         self.read_only = False
         self.type = "system"
+        self.location = ''
 
     def load_config_dict(self, cfg):
         """Loads configuration into the object from a dict.
@@ -147,9 +148,10 @@ class XendVDI(AutoSaveObject):
                 'sharable': False,
                 'readonly': False,
                 'SR': self.sr_uuid,
+                'location': self.get_location(),
                 'VBDs': []}
 
-    def get_image_uri(self):
+    def get_location(self):
         raise NotImplementedError()
                 
 
@@ -163,9 +165,10 @@ class XendQCoWVDI(XendVDI):
         self.virtual_size = vsize
         self.sector_size = 512
         self.auto_save = True
+        self.location = 'tap:qcow:%s' % self.qcow_path
 
-    def get_image_uri(self):
-        return 'tap:qcow:%s' % self.qcow_path
+    def get_location(self):
+        return self.location
 
 class XendLocalVDI(XendVDI):
     def __init__(self, vdi_struct):
@@ -183,7 +186,7 @@ class XendLocalVDI(XendVDI):
         self.type = vdi_struct.get('type', '')
         self.sharable = vdi_struct.get('sharable', False)
         self.read_only = vdi_struct.get('read_only', False)
-        self.image_uri = vdi_struct.get('uri', 'file:/dev/null')
+        self.location = vdi_struct.get('location', 'file:/dev/null')
 
-    def get_image_uri(self):
-        return self.image_uri
+    def get_location(self):
+        return self.location